//
//  WPMRModel.m
//  wobingwoyi
//
//  Created by WGP on 16/8/15.
//  Copyright © 2016年 WGP. All rights reserved.
//

#import "WPMRModel.h"
#import "WPReturnListModel.h"
#import "WPTreamentProgressListModel.h"
#import "WPVideoOrAudioModel.h"

@implementation WPMRModel

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeInteger:_id forKey:@"id"];
    [aCoder encodeInteger:_userId forKey:@"userId"];
    [aCoder encodeObject:_userName forKey:@"userName"];
    [aCoder encodeObject:_userImage forKey:@"userImage"];
    [aCoder encodeBool:_payable forKey:@"payable"];
    [aCoder encodeInt:_pay forKey:@"pay"];
    [aCoder encodeInt:_readAmount forKey:@"readAmount"];
    [aCoder encodeInteger:_collectAmount forKey:@"collectAmount"];
    [aCoder encodeInteger:_appraiseAmount forKey:@"appraiseAmount"];
    [aCoder encodeBool:_verified forKey:@"verified"];
    [aCoder encodeBool:_verified forKey:@"verifyStatus"];
    [aCoder encodeObject:_treatmentTime forKey:@"treatmentTime"];
    [aCoder encodeInt:_updateTimes forKey:@"updateTimes"];
    [aCoder encodeInt:_tag forKey:@"tag"];
    [aCoder encodeObject:_spare forKey:@"spare"];
    
    [aCoder encodeObject:_name forKey:@"name"];
    [aCoder encodeInt64:_uploadTime forKey:@"uploadTime"];
    [aCoder encodeObject:_hospital forKey:@"hospital"];
    [aCoder encodeObject:_doctor forKey:@"doctor"];
    [aCoder encodeObject:_sex forKey:@"sex"];
    [aCoder encodeInt:_age forKey:@"age"];
    [aCoder encodeObject:_diseaseCategoryId forKey:@"diseaseCategoryId"];
    [aCoder encodeObject:_cureStatus forKey:@"cureStatus"];
    [aCoder encodeObject:_department forKey:@"department"];
    [aCoder encodeObject:_treatmentProcess forKey:@"treatmentProcess"];
    
    
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    if(self = [super init])
    {
        
        _id = [aDecoder decodeIntegerForKey:@"id"];
        _userId = [aDecoder decodeIntegerForKey:@"userId"];
        _userName = [aDecoder decodeObjectForKey:@"userName"];
        _userImage = [aDecoder decodeObjectForKey:@"userImage"];
        _pay = [aDecoder decodeIntForKey:@"pay"];
        _readAmount = [aDecoder decodeIntForKey:@"readAmount"];
        _collectAmount = [aDecoder decodeIntForKey:@"collectAmount"];
        _appraiseAmount = [aDecoder decodeIntForKey:@"appraiseAmount"];
        _payable = [aDecoder decodeBoolForKey:@"payable"];
        _verified = [aDecoder decodeBoolForKey:@"verified"];
        
        _name = [aDecoder decodeObjectForKey:@"name"];
        _uploadTime = [aDecoder decodeInt64ForKey:@"uploadTime"];
        _hospital = [aDecoder decodeObjectForKey:@"hospital"];
        _doctor = [aDecoder decodeObjectForKey:@"doctor"];
        _sex = [aDecoder decodeObjectForKey:@"sex"];
        _age = [aDecoder decodeIntForKey:@"age"];

        
    }
    return self;
}

// 返回容器类中的所需要存放的数据类型 (以 Class 或 Class Name 的形式)。
+ (NSDictionary *)modelContainerPropertyGenericClass
{
    return @{@"returnVisit_list" : [WPReturnListModel class],
             @"processDescp_list" : [WPTreamentProgressListModel class],
             @"processMultfile_list": [WPVideoOrAudioModel class],
             };
}

-(void)setRecordDescp_list:(NSArray *)recordDescp_list
{
    _recordDescp_list = recordDescp_list;
    
    NSMutableArray *array = [NSMutableArray array];
    NSMutableString *mutableStr = [NSMutableString string];
    
    for (NSString *str in recordDescp_list)
    {
        //此处判断不太严谨,还待完善
        if ([str hasPrefix:@"http://"])
        {
            [array addObject:str];
        }
        else
        {
            [mutableStr appendString:str];
        }
    }
    self.firstOptionStr = mutableStr;
    self.firstOptionUrls = array.copy;
}

-(void)setTreatmentProcess_list:(NSArray *)treatmentProcess_list
{
    _treatmentProcess_list = treatmentProcess_list;
    
    NSMutableArray *array = [NSMutableArray array];
    NSMutableString *mutableStr = [NSMutableString string];
    
    for (NSString *str in treatmentProcess_list)
    {
        //此处判断不太严谨,还待完善
        if ([str hasPrefix:@"http://"])
        {
            [array addObject:str];
        }
        else
        {
            [mutableStr appendString:str];
        }
    }
    self.treamentProcessStr = mutableStr;
    self.treamentProcessArr = array.copy;
}

@end
